package com.briup.smartcity_group1.utils.result;

import com.briup.smartcity_group1.exception.ServiceException;

public class Result {

    private static String dataMessage = "";

    private Integer status;
    private String message;
    private Object data;

    public Result() {
        this.status = ResultCode.SUCCESS.getCode();
        this.message = ResultCode.SUCCESS.getMsg();
        this.data = Result.dataMessage;
    }

    public Result(ResultCode resultCode) {
        this.status = resultCode.getCode();
        this.message = resultCode.getMsg();
    }

    public Result(Integer status, String message) {
        this.status = status;
        this.message = message;
    }

    public Result(Integer status, String message, Object data) {
        this.status = status;
        this.message = message;
        this.data = data;
    }

    public Result(ServiceException se) {
        this.status = se.getStatus();
        this.message = se.getMessage();
    }

    public static void setDataMessage(String dataMessage) {
        Result.dataMessage = dataMessage;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

}